Import packages.
In [1]:
import numpy as np
import matplotlib.pylab as plt
In this problem, I plot the magnitude of the time averaged Poynting vector for a half-wave antenna. The antenna is oriented vertically in this problem.
In [2]:
#Define constants - permeability of free space, speed of light, current amplitude.
u_0 = 1.26 * 10**(-6)
c = 2.997925 * 10**8
I_0 = 5
#Choose any current amplitude value, I_0.
In [3]:
def S_avg(x, r):
return (u_0 * c * I_0**2)/(8 * np.pi * r**2) * np.cos(np.pi/2 * np.cos(x))**2/np.sin(x)**2
In [4]:
#Plot average Poynting vector magnitude at different angles.
fig = plt.figure(figsize = (8, 8))
ax = fig.add_subplot(1, 1, 1, projection = 'polar')
#Define a range of angles.
theta = np.arange(0, 2 * np.pi, 0.01)
#Plot Poynting vector magnitude at different radii.
ax.plot(theta, S_avg(theta, r = 1), color = 'red', label = 'r = 1')
#Plot an example vector.
x = 0
y = 0
u = S_avg(np.pi/3, r = 1) * np.sin(np.pi/3)
v = S_avg(np.pi/3, r = 1) * np.cos(np.pi/3)
ax.quiver(x, y, u, v, scale_units = 'xy', scale = 0.5, color = 'red')
#Adjust plot labels.
ax.set_rticks([100, 200, 300])
ax.set_rlabel_position(0)
ax.grid(True)
#Flip plot axes to match antenna position from notes.
ax.set_theta_offset(np.pi/2)
ax.set_theta_direction(-1)
#Add title.
ax.set_title('Time Average of Poynting Vector at Different Angles Around Antenna, \n One Meter Away', fontsize = 16, verticalalignment = 'bottom')
plt.legend(title = 'Radius in Meters', loc = [0.91, 0.91])
plt.tight_layout()
plt.show()
In [5]:
#Define a range of angles.
theta = np.arange(0, 2 * np.pi, 0.01)
def S_avg(x, r):
return (u_0 * c * I_0**2)/(8 * np.pi * r**2) * np.cos(np.pi/2 * np.cos(x))**2/np.sin(x)**2
#Plot average Poynting vector magnitude at different angles.
fig = plt.figure(figsize = (8, 8))
ax = fig.add_subplot(1, 1, 1, projection = 'polar')
#Plot Poynting vector magnitude at different radii.
ax.plot(theta, S_avg(theta, r = 1), color = 'red', label = 'r = 1')
ax.plot(theta, S_avg(theta, r = 2), color = 'blue', label = 'r = 2')
ax.plot(theta, S_avg(theta, r = 3), color = 'purple', label = 'r = 3')
#Plot an example vector.
theta = np.pi/3
x = 0
y = 0
u = S_avg(theta, r = 1)
v = 0
ax.quiver(x, y, u*np.sin(theta), u*np.cos(theta), scale_units = 'xy', scale = 0.5, color = 'red')
#Adjust plot labels.
ax.set_rticks([100, 200, 300])
ax.set_rlabel_position(90)
ax.grid(True)
#Flip plot axes to match antenna position from notes.
ax.set_theta_offset(np.pi/2)
ax.set_theta_direction(-1)
#Add title.
ax.set_title('Time Average of Poynting Vector at Different Angles Around Antenna', fontsize = 16, verticalalignment = 'bottom')
plt.legend(title = 'Radius in Meters', loc = [0.91, 0.91])
plt.tight_layout()
plt.savefig('Time Average of Poynting Vector at Different Angles Around Antenna.png')
plt.show()
In [6]:
def S_avg(x, r):
return (u_0 * c * I_0**2)/(8 * np.pi * r**2) * np.cos(np.pi/2 * np.cos(x))**2/np.sin(x)**2
#Plot average Poynting vector magnitude at different angles.
fig = plt.figure(figsize = (8, 8))
ax = fig.add_subplot(1, 1, 1, projection = 'polar')
meters = 1
n = 36
theta = np.linspace(0, 2 * np.pi , n)
r = np.linspace(meters, meters, 1)
X, Y = np.meshgrid(theta, r)
u = S_avg(X,Y)
v = 0
ax.quiver(X, Y, u*np.sin(X), u*np.cos(X), color = 'red', width = 0.005)
#Adjust plot labels.
ax.set_rticks([1, 2, 3, 4])
ax.set_rlabel_position(90)
ax.grid(True)
#Flip plot axes to match antenna position from notes.
ax.set_theta_offset(np.pi/2)
ax.set_theta_direction(-1)
#Add title.
ax.set_title('Time Average Poynting Vector at Different Angles Around Antenna', fontsize = 16, verticalalignment = 'bottom')
#plt.savefig('Time Average Poynting Vector at One Meter from Antenna.png')
plt.show()